package com.luck.timing;

import com.luck.api.UserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Hua wb on 2018/8/28.
 * 去掉component即可
 */
@Component
public class OneTimer {
    private static Logger logger = LoggerFactory.getLogger(OneTimer.class);
    @Autowired
    private UserManager userManager;
    @Scheduled(cron = "0 0 0 1/1 * ? ")
    public void printHello(){
        int i = userManager.deleteNoActivate();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        logger.debug("OneTimer--时间:{},删除未激活用户个数{}...", sdf.format(new Date()), i);
    }
}
